import {Button, Gap, SearchForm, Table, Upload} from "@/components";
import {useMyTable, useRowSelection} from "@/hooks";
import {useNavigate, useParams} from "react-router-dom";
import {ColumnsType} from "antd/es/table";
import {uploadImg} from "@/api";

import {message, Space} from "antd";
import {useState} from "react";

const upload = () => {

    const [fileId, setFileId] = useState("");

    const handleUpload = async (params: any) => {
        const {onSuccess, onError, file, onProgress} = params;

        const [err, res] = await uploadImg({file});
        console.log(res)
        if (res && res["code"]==200) {
            message.success("上传成功!");
            setFileId(res.data)
        }

    };

    return (
        <>
            <div className="wrapper">
                <Upload customRequest={handleUpload} showUploadList={false}/>
                <h4>{fileId}</h4>
            </div>
        </>
    );
};
export default upload;
